package org.hive.testserver.domain.model.schedule;

import java.io.Serializable;

import org.hive.testserver.domain.model.Slave;
import org.hive.testserver.domain.model.Test;
import org.hive.testserver.domain.model.WorkSheet;

/**
 * Null Allocator will never accept any tests and in turn will not schedule a test.
 * Instances are often used to terminate an allocator chain.
 */
public class NullAllocator implements AllocatorLink, Serializable {

	private static final long serialVersionUID = 1L;

	public boolean accept(Test test, Slave slave, WorkSheet workSheet) {
		return false;
	}

	public AllocatorLink createWorkingCopy() {
		return this;
	}

	public ScheduledTest scheduleNextTest(Slave slave, WorkSheet workSheet) {
		return new ScheduledTest(ScheduleReason.NOTHING_SUITABLE_TO_RUN);
	}

	public boolean shouldConsiderTestFinished(Test test) {
		return false;
	}

}
